<?php
$c = $contents;
$dir = lang::get_domain_lang() == 'en' ? '' : 'dir="rtl"';
?>
<input id="torrent_title" type="hidden" value="<?=$c['torrent_title']?>"/>
<input id="torrent_episode_title" type="hidden" value="<?=$c['titleonly']?>"/>


<table itemscope="1" itemtype="http://schema.org/Movie" style="empty-cells: show;">
<tr>
<td style="text-align:center;width: 234px;vertical-align:top;background-image: url('http://<?=$res_server?>/res/img/paperTextureBgTile.png')">
    <div id="udn_leftbar">
        <div <?= $c['poster'] != 'http://'.$dl_server.'/dl/' ? 'rel="gallery"' : ''?>>
            <a title="<?=$c['title']?> <?=$c['title_lang']?> Download Poster" href="<?=udnutil::dlurl($c['large_poster'])?>">
                <img itemprop="image" id="udn_poster" alt="poster" style="width: 214px; height: 317px;"
                     src="<?= $c['poster'] != 'http://'.$dl_server.'/dl/' ? udnutil::dlurl($c['poster']) : 'http://'.$res_server.'/res/img/no_poster.jpg'?>"/>
            </a>
        </div>

        <div class="fb-like" data-href="http://facebook.com/udnmovies" data-send="true" data-layout="button_count" data-width="214" data-show-faces="false" data-font="verdana" data-colorscheme="dark"></div>

        <div style="margin:10px auto">
            <a href="#udn_section_similar" title="<?=lang::get('find_similar')?> <?=$c['title']?>">
                <?=lang::get('find_similar')?> <?=$c['title']?>
            </a>
        </div>
        <div style="text-align: center; margin-bottom: 10px;">
            <?=ad::get_ad("left_box_1");?>
        </div>

        <div itemprop="duration"><strong>Runtime:</strong><?=$c['runtime']?></div>
        <div itemprop="director">Directed By:
            <?foreach($c['directors'] as $director){?>
                <?=$director?>,
            <?}?>
        </div>
        <div itemprop="datePublished">Release:<?=$c['release']?></div>
        <h3><?=lang::get('cast')?></h3>
        <div itemprop="actors" id="udn_actors">
            <ul>
                <?foreach ($c['actors'] as $actor) { ?>
                    <?if($actor['name'] != ''){?>
                        <li>
                            <div class="udn_actor" style="height: 50px; margin: 5px">
                                <a title="<?=$actor['name']?>" href="<?=$actor['actorurl']?>">
                                    <img class="lazy" src="http://<?=$res_server?>/res/img/movie.png" data-original="<?= $actor['img'] != 'http://'.$dl_server.'/dl/' ? udnutil::dlurl($actor['img']) : 'http://'.$res_server.'/res/img/name.png'?>" alt="" style="width: 32px; height: 44px;"/>
                                    <div>
                                        <span itemprop="actor"><?=$actor['name']?></span>
                                        <div><?=$actor['role']?></div>
                                    </div>
                                </a>
                            </div>
                        </li>
                    <?}?>
                <?}?>
            </ul>
        </div>
        <div style="text-align: center; margin-bottom: 10px;">
            <?=ad::get_ad("left_bar_1");?>
            <?=ad::get_ad("left_bar_2");?>
        </div>

    </div>
</td>
<td style="background-image: url('http://<?=$res_server?>/res/img/paperTextureFooterEdgeTile.png');background-repeat:repeat-y;width: 20px;"></td>
<td style="vertical-align: top;">
    <!--background image-->
    <img itemprop="image" src="<?=udnutil::dlurl($c['large_poster'])?>"
            style="background-size: cover;
                    display: block;
                    opacity:0.4;
                    position: absolute;
                    width: 740px;
                    height: 1097px;
                    z-index: -2;
                    -moz-box-shadow: 0px 0px 0px rgba(0, 0, 0, .0);
                    -webkit-box-shadow: 0px 0px 0px rgba(0, 0, 0, .7);
                    box-shadow: 0px 0px 0px rgba(0, 0, 0, .0);"/>
    <img src="http://<?=$res_server?>/res/img/overlay.png"
            style="background-size: cover;
            display: block;
                    position: absolute;
                    width: 740px;
                    height: 1097px;
                    z-index: -1;
                    -moz-box-shadow: 0px 0px 0px rgba(0, 0, 0, .0);
                    -webkit-box-shadow: 0px 0px 0px rgba(0, 0, 0, .7);
                    box-shadow: 0px 0px 0px rgba(0, 0, 0, .0);"/>
    <!--end of background image-->

    <div id="udn_mainbar2" style="width: 728px">
        <div style="text-align: right">
            <a title="Report any issues by emailing udnweb@gmail.com" href="mailto:udnweb@gmail.com">Report Abuse / Copyright</a>
        </div>

        <!-- SECTION for TITLE -->
        <div id="udn_header">
            <h1 itemprop="name" id="udn_title">
                <?=$c['title']?> <span <?=$dir?>><?=$c['title_lang']?></span> <?=lang::get('torrent_download')?>
                <?= ad::get_ad('title')?>
            </h1>

            <!-- MAINBANNER-->
            <?=ad::get_ad("center_banner_1");?>
       </div>

        <!-- SECTION for GENRES and RATING -->
        <div id="udn_genres" style="float:left;width:500px;">
            <ul>
                <?foreach($c['genres'] as $genre){?>
                    <li>
                        <a href="transform?udnsearch=1&genres=<?=$genre?>">
                            <span itemprop="genre"><?=lang::get($genre)?></span>
                        </a>
                    </li>
                <?}?>
            </ul>
        </div>
        <?if($c['rating']!=''){?>
            <div style="float:left;font-size: 16px; text-align: right;width: 228px;color: orange;">
                <span><strong>&#9733; <?=$c['rating']?></strong> (<?=$c['votes']?> votes)</span>
            </div>
        <?}?>
        <div class="clear"></div>


        <!-- SECTION for TRAILERS -->
        <script type="text/javascript">
            searchYoutube("<?=$c['title']?> trailer", 'udn_trailer');
        </script>
        <div itemprop="trailer" id="udn_trailer">
            <img src="http://<?=$res_server?>/res/img/ajax-loader.gif" />
            Loading trailer...
        </div>
        <!-- SECTION for PLOT -->
        <?if($c['description'] != ''){?>
            <div class="more-less" id="descr">
                <p <?=$dir?> itemprop="description"><?=$c['description']?></p>
                <?if($c['description'] != $c['storyline']) {?>
                <p <?=$dir?>><?=$c['storyline']?></p>
                <?}?>
            </div>
            <div for="descr" class="more">More/Less..</div>
        <?}?>



        <div style="height: 20px;" class="udn_clear"></div>

        <!-- SECTION for TV SERIES SEASONS AND EPISODES -->
        <?if($c['mode'] == 'tv-series'){?>
            <h3 <?=$dir?>><?=lang::get('download_seasons');?></h3>
            <table style="height: 60px; margin-top: 20px; margin-bottom: 20px;">
                <tr>
                    <td>
                        <select id="udn_seasons_select" style="display: none;">
                            <?foreach($c['seasons'] as $season){?>
                                <option value="<?=$season?>"
                                        data-description="Season <?=$season?>"
                                        data-imagesrc="<?=udnutil::smallImdbImage($c['poster'])?>">
                                    Season <?=$season?>
                                </option>
                            <?}?>
                            <option value="x"
                                    data-description="All Seasons"
                                    data-imagesrc="<=?$c['tiny_poster']?>">
                                All Seasons</option>
                        </select>
                    </td>
                    <td style="width: 50px"></td>

                    <td>
                        <select id="udn_episodes_select" style="display: none;">

                        </select>
                    </td>
                </tr>
            </table>
        <?}?>

        <?=ad::get_ad("center_banner_2");?>

        <!-- SECTION for DOWNLOAD -->
        <div style="padding-top: 30px">
            <h3>Unlimited Download <?=ad::get_ad('title_2')?></h3>
        </div>





        <?=ad::get_ad("fake_download");?>

        <!-- SECTION for PHOTO GALLERY -->
        <?if(count($c['images']) > 0){?>
        <h3 <?=$dir?>><?=lang::get('gallery')?></h3>
        <div id="udn_gallery" rel="gallery">
            <ul>
                <?foreach($c['images'] as $image){?>
                <li>
                    <a href="<?=udnutil::dlurl($image['original'])?>">
                        <img class="lazy" src="http://<?=$res_server?>/res/img/movie.png" data-original="<?=udnutil::dlurl($image['thumbnail'])?>"/>
                    </a>
                </li>
                <?}?>
            </ul>
            <div class="udn_clear"></div>
        </div>
        <?}?>

        <!-- SECTION for SIMILAR -->
        <?if(count($c['similar']) > 0){?>
        <h3 <?=$dir?> id="udn_section_similar"><?=lang::get('similar')?></h3>
        <div class="more-less" id="udn_similar">
            <ul>
                <?foreach($c['similar'] as $m){?>
                    <li>
                        <a itemscope="1" itemtype="http://schema.org/Movie"
                           title="<?=$m['title']?>"
                           href="transform?movieid=<?=$m['id']?>&amp;title=<?=str_replace(' ', '-', $m['title'])?><?=lang::get('seo_url_movie');?>">
                            <img itemprop="image" alt="" class="lazy" src="http://<?=$res_server?>/res/img/movie.png" data-original="<?= $m['poster'] != 'http://'.$dl_server.'/dl/' ? udnutil::dlurl($m['poster']): 'http://'.$res_server.'/res/img/no_poster.jpg'?>"/>
                        </a>
                    </li>
                <?}?>
            </ul>
            <div class="udn_clear"></div>
        </div>
        <div for="udn_similar" class="more">More/Less..</div>
        <?}?>


        <!-- SECTION for REVIEWS -->
        <?if(count($c['reviews']) > 0){?>
        <h3 id="udn_section_review" <?=$dir?>><?=lang::get('reviews')?></h3>
        <div id="s_reviews" class="more-less">
            <?$i=0;?>
            <?foreach($c['reviews'] as $review){?>
                <p style="font-size: 16px">
                    <b>User Review <?=$i++?>: <?=$review['summary']?></b>
                    <br/><?=$review['rating']?>
                </p>
                <p itemprop="review">
                    <?=$review['text']?>
                </p>
                <hr/>
            <?}?>
        </div>
        <div for="s_reviews" class="more">More/Less..</div>
        <?}?>

        <!-- MORE/LESS -->
        <script type="text/javascript">
            $(function(){
                $('.more').click(function() {
                    $this = $('#' + $(this).attr("for"));
                    if ($this.data('open')) {
                        $this.animate({height:'180px'});
                        $this.data('open', 0);
                    }
                    else {
                        $this.animate({height:'100%'});
                        $this.data('open', 1);
                    }
                });
            });
        </script>

        <?=ad::get_ad("center_banner_3");?>

        <!-- SECTION for DOWNLOAD -->
        <div style="padding-top: 30px">
            <h3>Download <?=ad::get_ad('title_2')?></h3>
        </div>
        <?if($google){?>
            <?=ad::get_ad("on_download");?>
        <?}?>


        <script type="text/javascript">
            $(document).ready(function() {
                download("http://<?=$torrent_server?>", "<?=$c['torrent_title']?>", "@DVDRip-3D-480p-720p-1080p-SoundTrack-HDTV@R5-R6-DVDScr-CAM-TS-Telesync-CAMRip-telecine-hdcam", 'tabs', "DVDRip-720p-1080p", '<?=$download_page_prefex?>transform?download={0}&title={1}&id=<?=$_GET['movieid']?>&g=<?=$google ? 1 : 0?>&sterm=<?=urlencode($c['title'])?>&movieurl=<?=urlencode('http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'])?>');

            <?if($google){?>
                //$('#tabs').hide();
                <?}?>
            });
        </script>

        <?if($google){?>
            <?=ad::get_ad("overlay_download");?>
        <?}?>

        <div id="tabs"></div>


        <?if($google){?>
            <?=ad::get_ad("pop");?>
        <?}?>
    </div>

</td>
</tr>
</table>

<?= ad::get_ad('popunder');?>

<!--facebook-->
<div id="fb-root"></div>
<script>(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>